using System.ComponentModel;
using System.Globalization;
using Meebey.SmartIrc4net;

namespace Thunder.Irc.Parser.Default
{
    /// <summary>
    /// Handles the ChannelMessage message 
    /// </summary>
    internal class MessageParserChannelAction : MessageParser
    {
        /// <summary>
        /// Gets the type of message handled by the parser
        /// </summary>
        public override ReceiveType MessageType
        {
            get { return ReceiveType.ChannelAction; }
        }

        /// <summary>
        /// This method is invoked during message parsing.
        /// </summary>
        /// <param name="args">The <see cref="CancelMessageProcessingEventArgs"/> containing the message to be passed</param>
        /// <remarks>You can cancel further processing of the message by setting the <see cref="CancelEventArgs.Cancel"/> to true</remarks>
        protected override void ParseCore(CancelMessageProcessingEventArgs args)
        {
            this.Manager.WriteText(args.MessageData.Channel, args.MessageData, string.Format(CultureInfo.InvariantCulture, "{0}", args.MessageData.Message));
        }
    }
}